private static double euclidianDistance(double[] vector1, double[] vector2)
{
    double distance = 0;
    for (int i = 0; i < vector1.GetLength(0); i++)
    {
        distance += Math.Pow(vector1[i], 2) - Math.Pow(vector2[i], 2);
    }
    return Math.Sqrt(distance);
}

private static double[][] distanceMatrix(double[][] hks)
{
	double[][] distances = new double[hks.GetLength(0)][];
	for (int i = 0; i < hks.GetLength(0); i++)
	{
		distances[i] = new double[hks.GetLength(0)];
		for (int j = 0; j < hks.GetLength(0); j++)
		{
			distances[i][j] = euclidianDistance(hks[i], hks[j]);
		}
	}
	return distances;
}